home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-06-21 | 4.9 KB | 212 lines | [TEXT/CWIE] |
- //===================================================================
- //======================= Headers =============================
-
- #include "Window.h"
- #include "GameUtilities.h"
- #include "Screen.h"
-
- //===================================================================
- //======================= Globals =============================
-
-
- //===================================================================
- //======================= #define =============================
-
-
- //===================================================================
- //======================= Function Prototypes =====================
-
-
- /*----------------------------------------------------------------------------\
-
- Window :: Constructor
-
- \----------------------------------------------------------------------------*/
- Window :: Window( void )
- {
- front = true;
- draging = false;
-
- width = 0;
- height = 0;
-
- shaded = false;
- hiden = true;
-
- dragable = false;
- }
-
- /*----------------------------------------------------------------------------\
-
- Window :: Destructor
-
- \----------------------------------------------------------------------------*/
- Window :: ~Window( void )
- {
-
- }
-
- /*----------------------------------------------------------------------------\
-
- Window :: Init
-
- \----------------------------------------------------------------------------*/
- Boolean Window :: Init( void )
- {
- if( window.LoadPicBuff( 128 ) )
- {
- screenLoc.left = 0;
- screenLoc.top = 20;
- width = window.GetBoundsSize().right;
- height = window.GetBoundsSize().bottom;
- screenLoc.right = screenLoc.left + width;
- screenLoc.bottom = screenLoc.top + height;
-
- return true;
- }
-
- return false;
- }
-
- /*----------------------------------------------------------------------------\
-
- Window :: HandleMouseClick
-
- \----------------------------------------------------------------------------*/
- void Window :: HandleMouseClick( Boolean down , point where )
- {
- if( down )
- {
- draging = true;
- start = where;
- }
- else
- {
- if( draging )
- {
- screen.AddRectToUpdate( screenLoc );
-
- MyOffSetRect( &screenLoc , where.x - start.x , where.y - start.y );
-
- screen.AddRectToUpdate( screenLoc );
-
- draging = false;
- }
- }
- }
-
- /*----------------------------------------------------------------------------\
-
- Window :: HandleMouseMove
-
- \----------------------------------------------------------------------------*/
- void Window :: HandleMouseMove( point where )
- {
- if( draging )
- {
- screen.AddRectToUpdate( screenLoc );
-
- MyOffSetRect( &screenLoc , where.x - start.x , where.y - start.y );
- start = where;
-
- screen.AddRectToUpdate( screenLoc );
- }
- }
-
- /*----------------------------------------------------------------------------\
-
- Window :: PointInWindow
-
- - just saids if the point it inside the window area or not
- \----------------------------------------------------------------------------*/
- Boolean Window :: PointInWindow( point where )
- {
- return SectPtRect( where , screenLoc );
- }
-
- /*----------------------------------------------------------------------------\
-
- Window :: Active
-
- \----------------------------------------------------------------------------*/
- Boolean Window :: Front( void )
- {
- return( front );
- }
-
- /*----------------------------------------------------------------------------\
-
- Window :: SetFront
-
- \----------------------------------------------------------------------------*/
- void Window :: SetFront( Boolean f )
- {
- if( f != front )
- {
- front = f;
- screen.AddRectToUpdate( screenLoc );
- }
- }
-
- /*----------------------------------------------------------------------------\
-
- Window :: DrawToScreen
-
- \----------------------------------------------------------------------------*/
- void Window :: DrawToScreen( rect *where , Boolean backGround )
- {
- if( front && !backGround )
- {
- if( where == NULL )
- {
- screen.DrawGeneric( &window , &window.GetBoundsSize() , &screenLoc ,
- NULL , 0 , 0 , 0 );
- }
- else
- {
- screen.DrawGeneric( &window , &window.GetBoundsSize() , &screenLoc ,
- where , 0 , 0 , 0 );
- }
- }
- else
- {
- if( where == NULL )
- {
- screen.DrawGeneric( &window , &window.GetBoundsSize() , &screenLoc ,
- NULL , kDrawTint , 16 , 0xffff );
- }
- else
- screen.DrawGeneric( &window , &window.GetBoundsSize() , &screenLoc ,
- where , kDrawTint , 16 , 0xffff );
- }
- }
-
- /*----------------------------------------------------------------------------\
-
- Window :: HideWindow
-
- \----------------------------------------------------------------------------*/
- void Window :: HideWindow( Boolean h )
- {
-
- }
-
- /*----------------------------------------------------------------------------\
-
- Window :: ShadeWindow
-
- \----------------------------------------------------------------------------*/
- void Window :: ShadeWindow( Boolean s )
- {
-
- }
-
- /*----------------------------------------------------------------------------\
-
- Window :: AddToUpdate
-
- \----------------------------------------------------------------------------*/
- void Window :: AddToUpdate( void )
- {
- screen.AddRectToUpdate( screenLoc );
- }